package com.sso.controller;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sso.utils.CookieUtils;
@Controller
public class IndexController extends BaseController {
	@RequestMapping("/index")
	public String index(Model model) {
		String token = CookieUtils.getCookieValue(request, "SSO-TOKEN");
		if (StringUtils.isBlank(token)) {
			/**
			 * 重定向至代理跨域地址页
			 */
			return redirectTo("http://sso.test.com:80/login.html?ReturnURL=http%3A%2F%2Fmy.web.com%3A8080%2Fproxylogin.html");
		} else {
			model.addAttribute("userId",token);
		}
		return "index";
	}
	@RequestMapping("/test")
	public String test(Model model) {
		return "test";
	}
	
	
	
}
